(function() {
    'use strict';

    angular
        .module('milkbeeApp')
        .controller('GiftDetailController', GiftDetailController);

    GiftDetailController.$inject = ['$scope', '$rootScope', '$stateParams', 'previousState', 'entity', 'Gift'];

    function GiftDetailController($scope, $rootScope, $stateParams, previousState, entity, Gift) {
        var vm = this;

        vm.gift = entity;
        vm.previousState = previousState.name;

        var unsubscribe = $rootScope.$on('milkbeeApp:giftUpdate', function(event, result) {
            vm.gift = result;
        });
        $scope.$on('$destroy', unsubscribe);
    }
})();
